<template>
	<view class="wrap">
		<xk-header title="预约参观"></xk-header>
		<u-swiper height="200" :list="swiperList"></u-swiper>
		<view class="title-info">
			<view class="title">
				<view class="title-text">
					{{formData.name}}
				</view>
			</view>
			<view class="memo-info">
				<view class="memo-info-item">
					{{formData.people}}人  |  {{formData.area}}m²
				</view>
				<view class="memo-info-item">
					适合：{{formData.suit}}
				</view>
			</view>
			<view class="nav-bar">
				<view class="nav-text">
					<u-icon class="icon" name="map" color="#CE3527" size="18"></u-icon>
					<text>{{formData.address}}</text>
				</view>
				<view class="arrow">
					<u-icon name="arrow-right" color="#CE3527"></u-icon>
				</view>
			</view>
		</view>
		<view class="main-info">
			<view class="info-wrap">
				<view class="info-title">场地描述</view>
				<view class="text-info">{{formData.digest}}</view>
			</view>
			<view style="height: 120rpx;"></view>
			<view class="bottom-bar">
				<!-- <view class="phone-wrap">
					<button>
						<u-icon name="phone-fill" color="#CA9A65" size="18"></u-icon>
						<text>电话咨询</text>
					</button>
				</view> -->
				<view class="button-wrap">
					<u-button type="primary" :custom-style="{'background-color':'#CE3527'}" @click="navToOrder">立刻预约</u-button>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
import request from './api'

export default {
  data() {
    return {
      swiperList: [],
      formData: {
        name: '',
        digest: '',
        suit: '',
        people: '',
        area: '',
        address: '',
      },
      id: 0,
    };
  },
  onLoad(options) {
    if (options.id) {
      this.id = options.id;
      this.getDetail(this.id);
    }
  },
  methods: {
    getDetail(meetingRoomId) {
      request.getMeetingRoomDetail({ meetingRoomId }).then(data => {
		  console.log(data);
        this.formData = {
          name: data.meeting_room_name,
          digest: data.description,
          suit: data.suit,
          people: data.capacity,
          area: data.area_size,
          address: data.position,
        };
        // this.swiperList = data.meeting_room_pictures?.split(';');
		const imgIdArr = data.meeting_room_pictures?.slice(0, -1)?.split(';');
		imgIdArr.forEach(item=>{
			this.swiperList.push(`https://ibms.on-bright.com:28095/file/download?file_id=${item}`)
		})
      });
    },
    navToOrder() {
      uni.navigateTo({
        url: './activitySiteReservation?id=' + this.id + '&name=' + this.formData.name + '&num=' + this.formData.people,
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.wrap{
	.title-info{
		background-color: #FFF6F5;
		padding: 28rpx;
		color: #666666;
		border-bottom: 1px solid #FCE5CE;
		.title{
			display: flex;
			justify-content: space-between;
			align-items: center;
			&-text{
				color: #333333;
				font-size: 36rpx;
			}
			&-share{
				&-button{
					display: flex;
					align-items: center;
					gap: 4rpx;
					color: #666666;
					background-color: transparent;
					border: none;
					box-shadow: none;
					font-size: 26rpx;
					line-height: 34rpx;
		
				}
				button:after{
					border: none;
				}
			}
		}
		.memo-info{
			font-size: 24rpx;
			padding: 8rpx 0;
			color: #666666;
			&-item{
				padding: 8rpx 0
			}
		}
		.nav-bar{
			display: flex;
			justify-content: space-between;
			align-items: center;
			.nav-text{
				flex: 9;
				font-size: 24rpx;
				white-space: nowrap;
				overflow: hidden;
				text-overflow: ellipsis;
				display: flex;
				align-items: center;
				.icon{
					padding-right: 14rpx;
				}
			}
			.arrow{
				flex: 1;
				text-align: right;
			}
		}
	}
	.main-info{
		background-color: white;
		padding: 0 28rpx;
		min-height: 45vh;
		.info-wrap{
			padding: 30rpx 0;
			.info-title{
				padding: 18rpx 0;
				font-size: 32rpx;
				color: #333333;
			}
			.text-info{
				font-size: 24rpx;
				color: #666666;
			}
			.icon-list-info{
				background-color: white;
				padding: 20rpx 0;
				display: grid;
				grid-template-columns: repeat(4,25%);
				justify-content: center;
				align-content: flex-start;
				.icon-item{
					width: 100%;
					height: 150rpx;
					text-align: center;
					font-size: 28rpx;
					display: flex;
					flex-direction: column;
					justify-content: center;
					align-items: center;
					.icon{
						padding-bottom: 20rpx;
					}
				}
			}
		}
	}
	.bottom-bar{
		height: 130rpx;
		box-sizing: border-box;
		position: fixed;
		bottom: 0;
		right: 0;
		left: 0;
		background-color: white;
		padding: 24rpx 44rpx;
		display: flex;
		gap: 26rpx;
		.phone-wrap{
			flex: 1;
			button{
				display: flex;
				justify-content: center;
				align-items: center;
				color: #CA9A65;
				font-size: 28rpx;
				background-color: transparent;
				border-radius: 8rpx;
				border: 2rpx solid #CA9A65;
				u-icon{
					padding-right: 16rpx;
				}
			}
			button:after{
				border: none;
			}
		}
		.button-wrap{
			flex: 1;
		}
	}
	.line{
		height: 1px;
		opacity: 0.38;
		background-color: rgba(187, 187, 187, 1);
	}
}
</style>
